<?php
include '../class/Uploader.class.php';
$config = array(
    "savePath" => '../shops/images/'.$_SESSION['account'],
    "maxSize" => 10024, //单位KB
    "allowFiles" => array(".gif", ".png", ".jpg", ".jpeg", ".bmp"),
    'simpleFolder'=>true,
);
// print_r($config);exit;
$width=1900;
$height=628;
$width_l=550;
$height_l=56;
if($_REQUEST['upload_mth']=='logo'){
    $up = new Uploader("logo", $config);
    $info = $up->getFileInfo();
    $url  = "http://www.12301.cc/" . $info['url'];
//    print_r($info);
//    $path = $up->smart_resize_image(280,60);
    $title = $info['originalName'];
    $srcipt = <<< HTML
    <script>
    parent.jQuery("input#thumb_imgLogo").val('{$url}');
    parent.jQuery("img#previewLogo").attr('src','$url').attr('title','$title');
    parent.jQuery("img#lnk_prvLogo").attr('href','$url');
    parent.jQuery('#waitingUploadLogo').empty().text('上传成功！');
    </script>
HTML;
}

if($_REQUEST['upload_mth']=='banner'){
    $up = new Uploader("banner", $config);
    $info = $up->getFileInfo();
//    $path = $up->smart_resize_image(1000,350);
    $title = $info['originalName'];
    $path  = "http://www.12301.cc/" . $info['url'];
    $srcipt = <<< HTML
    <script>
    parent.jQuery("input#thumb_imgbanner").val('{$path}');
    parent.jQuery("img#previewbanner").attr('src','$path').attr('title','$title');
    parent.jQuery("img#lnk_prvbanner").attr('href','$path');
    parent.jQuery('#waitingUploadbanner').empty().text('上传成功！');
    </script>
HTML;
}
// echo $config['savePath'];
echo $srcipt;